package cn.liontalk.common.redis;

/**
 * @author: 周哲
 * @package: cn.liontalk.common.redis
 * @description:
 * @date: 2019/1/18 20:14
 * @version: V1.0
 */
public class BasePrefix implements KeyPrefix {


    private int expireSeconds;

    private String prefix;


    public BasePrefix( String prefix) {
        this(0, prefix);
    }


    public BasePrefix(int expireSeconds, String prefix) {
        this.expireSeconds = expireSeconds;
        this.prefix = prefix;
    }

    @Override
    public int expireSeconds() {
        return expireSeconds;
    }

    @Override
    public String getPrefix() {
        String name = getClass().getSimpleName();
        return name + ":" + prefix;
    }
}
